//
//  MainViewController.swift
//  iWatchManager
//
//  Created by GujyHy on 2018/1/23.
//  Copyright © 2018年 GujyHy. All rights reserved.
//

import UIKit
import swiftScan

class MainViewController: UIViewController {

    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "扫码"
        self.view.backgroundColor = UIColor.white
        
        self.view.addSubview(self.scanButton)
    }
 
    // MARK: lazy
    fileprivate lazy var scanButton:UIButton = {
        let button                = UIButton(type: .custom)
        button.center             = CGPoint(x: self.view.center.x/2, y: self.view.center.y)
        button.frame.size         = CGSize(width: 200, height: 50)
        button.setTitle("扫一扫", for:.normal)
        button.setTitleColor(UIColor.red, for: .normal)
        button.backgroundColor    = UIColor.white
        button.layer.borderColor  = UIColor.red.cgColor
        button.layer.borderWidth  = 0.5
        button.layer.cornerRadius = 5
        button.addTarget(self, action: #selector(scanButtonClicked), for: .touchUpInside)
        return button
    } ()
    
    @objc func scanButtonClicked(_ button:UIButton) {
        
        let vc = ProductsListViewController()
        
//        let vc = QRViewController()
//        var style = LBXScanViewStyle()
//        style.animationImage = UIImage(named: "qrcode_scan_light_green")
//        vc.scanStyle = style
        self.navigationController?.pushViewController(vc, animated: true)
    }


}

